<template>
  <div>
    <van-nav-bar
      title="我的消息"
      right-text="客服中心"
      @click-right="showService = true"
    />
    <van-cell class="personnels" to="/detailed">
      <div class="left-personnel">
        <van-icon name="fire-o" />
      </div>
      <div class="right-personnel">
        <div class="push">
          <h3>热门推送</h3>
          <div>保洁服务低至6折，养宠保洁低至199元！点击查看>></div>
        </div>
        <div class="person-time">昨天 13:33</div>
      </div>
    </van-cell>
    <router-view></router-view>
    <!-- 客服中心弹出层 -->
    <van-popup
      v-model="showService"
      closeable
      close-icon-position="top-left"
      close-icon="arrow-left"
      position="right"
      :style="{ height: '100%', width: '100%' }"
    >
      <service-centre
    /></van-popup>
  </div>
</template>

<script>
import serviceCentre from "./components/service.vue";
export default {
  components: {
    serviceCentre
  },
  data() {
    return {
      // 客服中心弹出层
      showService: false
    };
  },
  created() {},
  methods: {},
  computed: {},
  beforeRouteEnter(to, from, next) {
    // if(to.pa)
    // console.log(to,from);
    if (from.name === "goods_detail") {
      next(vm => {
        // 通过 `vm` 访问组件实例
        vm.showService = true;
      });
    }
    next();
  }
};
</script>

<style lang="less" scoped>
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
h3 {
  color: #111;
}
.personnels {
  height: 80px;
  .van-cell__value {
    display: flex;
    justify-content: center;
    align-items: center;
    .left-personnel {
      display: flex;
      justify-content: center;
      align-items: center;
      flex: 1;
      .van-icon {
        display: block;
        font-size: 30px;
        margin: 20px;
      }
    }
    .right-personnel {
      display: flex;
      justify-content: center;
      align-items: center;
      flex: 7;
      .push {
        min-width: 0;
        flex: 7;
        display: flex;
        flex-direction: column;
        div {
          white-space: nowrap;
          text-overflow: ellipsis;
          overflow: hidden;
          color: #999;
          width: 210px;
        }
      }
      .person-time {
        display: flex;
        height: 50px;
        color: #999;
        margin-right: 20px;
        font-size: 12px;
        text-align: right;
      }
    }
  }
}
</style>
